{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train labels shape: (16432,)\n",
      "Test labels shape: (2000,)\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "\n",
    "# 加载数据\n",
    "labels = np.load('train_label.npy')  \n",
    "print('Train labels shape:', labels.shape)\n",
    "\n",
    "# สำหรับการทดสอบ ให้โหลดกลุ่มข้อมูลทดสอบด้วย\n",
    "test_labels = np.load('test_label.npy')\n",
    "print('Test labels shape:', test_labels.shape)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train labels DataFrame shape: (16432, 1)\n",
      "   0\n",
      "0  0\n",
      "1  1\n",
      "2  2\n",
      "3  3\n",
      "4  4\n",
      "Test labels DataFrame shape: (2000, 1)\n",
      "   0\n",
      "0  0\n",
      "1  1\n",
      "2  2\n",
      "3  3\n",
      "4  4\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# 将 NumPy 数组转换为 Pandas DataFrame\n",
    "labels_df = pd.DataFrame(labels)\n",
    "print('Train labels DataFrame shape:', labels_df.shape)\n",
    "print(labels_df.head())  # 显示前几行数据\n",
    "\n",
    "# 处理测试标签\n",
    "test_labels_df = pd.DataFrame(test_labels)\n",
    "print('Test labels DataFrame shape:', test_labels_df.shape)\n",
    "print(test_labels_df.head())  # 显示前几行数据"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Train labels from .pkl: (16432, 1)\n",
      "   0\n",
      "0  0\n",
      "1  1\n",
      "2  2\n",
      "3  3\n",
      "4  4\n",
      "Test labels from .pkl: (2000, 1)\n",
      "   0\n",
      "0  0\n",
      "1  1\n",
      "2  2\n",
      "3  3\n",
      "4  4\n"
     ]
    }
   ],
   "source": [
    "import pandas as pd\n",
    "\n",
    "# 加载训练标签\n",
    "train_labels_df = pd.read_pickle('train_label.pkl')\n",
    "print('Train labels from .pkl:', train_labels_df.shape)\n",
    "print(train_labels_df.head())\n",
    "\n",
    "# 加载测试标签\n",
    "test_labels_df = pd.read_pickle('test_label.pkl')\n",
    "print('Test labels from .pkl:', test_labels_df.shape)\n",
    "print(test_labels_df.head())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Loaded from .pkl file:          0\n",
      "0        0\n",
      "1        1\n",
      "2        2\n",
      "3        3\n",
      "4        4\n",
      "...    ...\n",
      "16427  125\n",
      "16428  126\n",
      "16429  152\n",
      "16430  153\n",
      "16431  154\n",
      "\n",
      "[16432 rows x 1 columns]\n",
      "Data type: <class 'pandas.core.frame.DataFrame'>\n"
     ]
    }
   ],
   "source": [
    "import pickle\n",
    "\n",
    "# 检查训练标签的 .pkl 文件\n",
    "with open('train_label.pkl', 'rb') as f:\n",
    "    data = pickle.load(f)\n",
    "    print('Loaded from .pkl file:', data)\n",
    "    print('Data type:', type(data))"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.10"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
